package com.jltx.xq.relaxnewspro.utils;

/**
 * Created by bo on 2017/5/10.
 */

public class ScienceContentParser {
    private static String STR_CUT_LEFT = "<div class=\"container article-page\">";
    private static String STR_CUT_RIGHT = "<div class=\"recommend-articles\">";

    private String parseStr = null;

    private String endStr = null;

    public String getEndStr(){
        return endStr;
    }

    public ScienceContentParser(String parseStr){
        this.parseStr = parseStr;
        parseData();
    }

    private void parseData(){
        String first_cut[] = parseStr.split(STR_CUT_LEFT);
        if(first_cut.length>1){
            String second_cut[]=first_cut[1].split(STR_CUT_RIGHT);
            if(second_cut.length>1){
                endStr= STR_CUT_LEFT+second_cut[0]+"</div>";
            }else {
                XqLog.e("ERROR","第二次解析出错，未找到有效分割元素");
            }
        }else {
            XqLog.e("ERROR","第一次解析出错，未找到有效分割元素");
        }
    }
}
